<div id="sub_nav">
      <p>Quick Links:</p>
      <ul>
        <li></li>

      </ul>
    </div>
<div class="breadcrumb">
    <ul id="breadcrumb">
        <li><a href="<?php echo Configure::read('base_url');?>backstage" title="Home">
		<?php echo $this->Html->image("home.png", array("alt" => "Home",'class'=>'home','border'=>'0'));?>
		</a></li>
        <li><a href="<?php echo Configure::read('base_url');?>backstage/countries/block_countries" title="Block Countries">Block Countries</a></li>

    </ul>
</div>
<?php echo $this->element('admin/admin_leftmenu'); ?>
<div id="left">

    <!-- begin all content here -->

    <br class="clear" />

    <!-- success --><!-- error -->
    <?php
    echo $this->Session->flash();
    if ($this->Session->check('Message.auth'))
        echo $this->Session->flash('auth');
    ?>
    <div class="div_header"><?php __('Block Countries'); ?></div>
    <div class="div_content">
        <form method="post" id="add_admin" action="<?php echo Configure::read('base_url')."backstage/countries/block_countries";?>">
           <div id="firstpane" class="menu_list"> <!--Code for menu starts here-->
		<p class="menu_head">North America-(<?php echo $cna;?>)</p>
		<div class="menu_body">
                  <label class="selectall"> <input type="checkbox" id="select_na" name="na" /><span style="margin-left: 5px;">Select All / Deselect All</span></label>
                  <?php
                  $i=0;
                  foreach ($na as $nav): ?>
                  <label class="countryname">
                  <?php if (in_array($nav['Country']['id'], $cid)) {?>
                      <input type="checkbox" checked="checked"  name="data[country_name][<?php echo $i;?>]" id="na" value="<?php echo $nav['Country']['id'].'_1'; ?>" />
                 <?php }else{?>
                     <input type="checkbox"  name="data[country_name][<?php echo $i;?>]" id="na" value="<?php echo $nav['Country']['id'].'_1'; ?>" />
                  <?php }?>
                     <input type="hidden" name="data[con_name][<?php echo $i;?>]" value="<?php echo $nav['Country']['id'].'_1'; ?>" />
                 <span style="margin-left: 5px;"><?php echo $nav['Country']['name']; ?></span></label>
                  <?php
                  $i++;
                  endforeach;?>
		</div>
		<p class="menu_head">South America-(<?php echo $csa;?>)</p>
		<div class="menu_body">
                    <label class="selectall">  <input type="checkbox" id="select_sa" name="sa" /><span style="margin-left: 5px;">Select All / Deselect All</span></label>
                    <?php foreach ($sa as $nav): ?>
                    <label class="countryname">
                         <?php if (in_array($nav['Country']['id'], $cid)) {?>
                      <input type="checkbox" checked="checked"  name="data[country_name][<?php echo $i;?>]" id="sa" value="<?php echo $nav['Country']['id'].'_2'; ?>" />
                 <?php }else{?>
                     <input type="checkbox"  name="data[country_name][<?php echo $i;?>]" id="sa" value="<?php echo $nav['Country']['id'].'_2'; ?>" />
                  <?php }?>
                    <input type="hidden" name="data[con_name][<?php echo $i;?>]" value="<?php echo $nav['Country']['id'].'_2'; ?>" />
                        <span style="margin-left: 5px;"><?php echo $nav['Country']['name']; ?></span></label>
                    <?php
                    $i++;
                    endforeach;?>
		</div>
		<p class="menu_head">Europe-(<?php echo $cep;?>)</p>
		<div class="menu_body">
          <label class="selectall"> <input type="checkbox" id="select_ep" name="ep" /><span style="margin-left: 5px;">Select All / Deselect All</span></label>
                  <?php foreach ($ep as $nav): ?>
                  <label class="countryname">
                      <?php if (in_array($nav['Country']['id'], $cid)) {?>
                      <input type="checkbox" checked="checked"  name="data[country_name][<?php echo $i;?>]" id="ep" value="<?php echo $nav['Country']['id'].'_3'; ?>" />
                 <?php }else{?>
                     <input type="checkbox"  name="data[country_name][<?php echo $i;?>]" id="ep" value="<?php echo $nav['Country']['id'].'_3'; ?>" />
                  <?php }?>
                    <input type="hidden" name="data[con_name][<?php echo $i;?>]" value="<?php echo $nav['Country']['id'].'_3'; ?>" />
                      <span style="margin-left: 5px;"><?php echo $nav['Country']['name']; ?></span></label>
                  <?php
                  $i++;
                  endforeach;?>
                </div>
                <p class="menu_head">Asia-(<?php echo $cas;?>)</p>
		<div class="menu_body">
           <label class="selectall"> <input type="checkbox" id="select_as" name="as" /><span style="margin-left: 5px;">Select All / Deselect All</span></label>
                  <?php foreach ($as as $nav): ?>
                  <label class="countryname">
                     <?php if (in_array($nav['Country']['id'], $cid)) {?>
                      <input type="checkbox" checked="checked"  name="data[country_name][<?php echo $i;?>]" id="as" value="<?php echo $nav['Country']['id'].'_4'; ?>" />
                 <?php }else{?>
                     <input type="checkbox"  name="data[country_name][<?php echo $i;?>]" id="as" value="<?php echo $nav['Country']['id'].'_4'; ?>" />
                  <?php }?>
                     <input type="hidden" name="data[con_name][<?php echo $i;?>]" value="<?php echo $nav['Country']['id'].'_4'; ?>" />
                      <span style="margin-left: 5px;"><?php echo $nav['Country']['name']; ?></span></label>
                  <?php
                  $i++;
                  endforeach;?>
                </div>
                <p class="menu_head">Oceania-(<?php echo $coc;?>)</p>
		<div class="menu_body">
           <label class="selectall"> <input type="checkbox" id="select_oc" name="oc" /><span style="margin-left: 5px;">Select All / Deselect All</span></label>
                  <?php foreach ($oc as $nav): ?>
                  <label class="countryname">
                      <?php if (in_array($nav['Country']['id'], $cid)) {?>
                      <input type="checkbox" checked="checked"  name="data[country_name][<?php echo $i;?>]" id="oc" value="<?php echo $nav['Country']['id'].'_5'; ?>" />
                 <?php }else{?>
                     <input type="checkbox"  name="data[country_name][<?php echo $i;?>]" id="oc" value="<?php echo $nav['Country']['id'].'_5'; ?>" />
                  <?php }?>
                     <input type="hidden" name="data[con_name][<?php echo $i;?>]" value="<?php echo $nav['Country']['id'].'_5'; ?>" />
                      <span style="margin-left: 5px;"><?php echo $nav['Country']['name']; ?></span></label>
                  <?php
                  $i++;
                  endforeach;?>
                </div>
                <p class="menu_head">Africa-(<?php echo $caf;?>)</p>
		<div class="menu_body">
           <label class="selectall"> <input type="checkbox" id="select_af" name="af" /><span style="margin-left: 5px;">Select All / Deselect All</span></label>
                  <?php foreach ($af as $nav): ?>
                  <label class="countryname">
                      <?php if (in_array($nav['Country']['id'], $cid)) {?>
                      <input type="checkbox" checked="checked"  name="data[country_name][<?php echo $i;?>]" id="af" value="<?php echo $nav['Country']['id'].'_6'; ?>" />
                 <?php }else{?>
                     <input type="checkbox"  name="data[country_name][<?php echo $i;?>]" id="af" value="<?php echo $nav['Country']['id'].'_6'; ?>" />
                  <?php }?>
                     <input type="hidden" name="data[con_name][<?php echo $i;?>]" value="<?php echo $nav['Country']['id'].'_6'; ?>" />
                      <span style="margin-left: 5px;"><?php echo $nav['Country']['name']; ?></span></label>
                  <?php
                  $i++;
                  endforeach;?>
                </div>
  </div><input type="submit" style="background:#73AE0B; color:#fff; font-size:14px;" name="button" id="button" value="Submit" />
             </form>
            </div>
            <div class="div_bottom"></div>
        </div>

        <!-- edit sidebar items here -->

        </div>
<?php
                        echo $this->Html->css('table_css');
?>

<?php echo $html->script(array("jquery.pagination.js", "jquery.tablesorter.min.js", "jquery.tablednd.js")); ?>
<script type="text/javascript">

    jQuery(document).ready(function(){
        jQuery("#category_table").tablesorter({headers: {4:{sorter: false}, 5:{sorter: false}}});
    });
</script>
        <script type="text/javascript">
jQuery(document).ready(function()
{
	//slides the element with class "menu_body" when paragraph with class "menu_head" is clicked
	jQuery("#firstpane p.menu_head").click(function()
    {
        
        jQuery(this).css({backgroundImage:"url('<?php echo $this->webroot; ?>img/down.png')"}).next("div.menu_body").slideToggle(400).siblings("div.menu_body").slideUp("slow");
       	jQuery(this).siblings().css({backgroundImage:"url('<?php echo $this->webroot; ?>img/left.png')"});
        
	});

         //Check all
		jQuery("#select_na").click(function()
			{
				var checked_status = this.checked;

				jQuery("input[id=na]").each(function()
				{
                                   this.checked = checked_status;
                                    
				});
			});

                         //Check all
		jQuery("#select_sa").click(function()
			{
				var checked_status = this.checked;

				jQuery("input[id=sa]").each(function()
				{
                                   this.checked = checked_status;

				});
			});

                         //Check all
		jQuery("#select_ep").click(function()
			{
				var checked_status = this.checked;

				jQuery("input[id=ep]").each(function()
				{
                                   this.checked = checked_status;

				});
			});

                         //Check all
		jQuery("#select_as").click(function()
			{
				var checked_status = this.checked;

				jQuery("input[id=as]").each(function()
				{
                                   this.checked = checked_status;

				});
			});

                         //Check all
		jQuery("#select_oc").click(function()
			{
				var checked_status = this.checked;

				jQuery("input[id=oc]").each(function()
				{
                                   this.checked = checked_status;

				});
			});

                         //Check all
		jQuery("#select_af").click(function()
			{
				var checked_status = this.checked;

				jQuery("input[id=af]").each(function()
				{
                                   this.checked = checked_status;

				});
			});
});
</script>
        <style type="text/css">
.menu_list {
	width: 700px;
}
.menu_head {
	padding: 5px 10px;
	cursor: pointer;
	position: relative;
	margin:1px;
    font-weight:bold;
    background: #eef4d3 url('<?php echo $this->webroot; ?>img/left.png') center right no-repeat;
}
.menu_body {
	display:none;
        max-height: 400px;
        overflow: auto;
        width:696px;
}
.menu_body a{
  display:block;
  color:#006699;
  background-color:#EFEFEF;
  padding-left:10px;
  font-weight:bold;
  text-decoration:none;
}
.selectall{
  display:block;
  color:#000;
  background-color:#EFEFEF;
  padding-left:10px;
  font-weight:bold;
  text-decoration:none;
}
.countryname{
  display:block;
  color:#006699;
  background-color:#EFEFEF;
  padding-left:10px;
  font-weight:bold;
  text-decoration:none;
}
.menu_body a:hover{
  color: #000000;
  text-decoration:underline;
  }
  label {

    margin: 0 0 0px;
}

  a.back {color:#003399; text-decoration:done;}
  a.back:hover { text-decoration:underline;}
</style>